// Backend/routes/gameRoutes.js
const express = require('express');
const router = express.Router();
const pool = require('../db'); // 引入数据库连接池

router.get('/', async (req, res) => {
    try {
        const [rows] = await pool.execute('SELECT * FROM games');
        res.json(rows);
    } catch (error) {
        res.status(500).json({ message: '服务器错误' });
    }
});

module.exports = router;